package com.niguang.work.labour.api.controller;


import com.niguang.work.labour.api.service.AdminLaborCompanySiteService;
import com.niguang.work.labour.common.pojo.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.validation.constraints.NotNull;

/**
 * <p>
 * 劳务公司工地关联关系表 前端控制器
 * </p>
 *
 * @author 83673
 * @since 2018-11-17
 */
@RestController
@RequestMapping("adminLaborCompanySite")
public class AdminLaborCompanySiteController {
    @Autowired
    private AdminLaborCompanySiteService adminLaborCompanySiteService;

    /**
     * 模糊搜索用户名下工地
     *
     * @param siteName
     * @return
     */
    @GetMapping("searchLabor")
    Result searchLabor(String siteName) {
        return adminLaborCompanySiteService.searchLabor(siteName);
    }

    /**
     * 查询项目下班组
     *
     * @return
     */
    @GetMapping("searchSiteLabor")
    Result searchSiteLabor(@NotNull @RequestParam Long siteId) {
        return adminLaborCompanySiteService.searchSiteLabor(siteId);
    }

    /**
     * 获取工种
     *
     * @return
     */
    @GetMapping("getWorkType")
    public Result getWorkType() {

     return    adminLaborCompanySiteService.getWorkType();
    }


    /**
     * 搜索用户信息
     * @param userPhone
     * @return
     */
    @GetMapping("getLaborUser")
    public Result getLaborUser(String userPhone) {
        return adminLaborCompanySiteService.getLaborUser(userPhone);
    }


}

